﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace console.demo.linq
{
    public class LinqSort
    {
        static string[] words = { "the", "quick", "brown", "fox", "jumps" };
        /// <summary>
        /// 执行查询排序
        /// </summary>
        public static void Get()
        {
            IEnumerable<string> query = from word in words orderby word select word;
            foreach (string str in query)
            {
                Console.WriteLine(str);
            }

            IEnumerable<string> res = from word in words orderby word.Substring(0, 1) descending select word;

            foreach (string str in res)
            {
                Console.WriteLine(str);
            }
        }
    }
}
